package com.sky.content.api;

import com.sky.content.dto.BindTeachplanMediaDto;
import com.sky.content.dto.SaveTeachplanDto;
import com.sky.content.dto.TeachplanDto;
import com.sky.content.model.po.TeachplanMedia;
import com.sky.content.service.TeachplanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 尹稳健~
 * @version 1.0
 * @time 2023/6/11
 */
@Api(tags = "课程计划编辑接口")
@RestController
public class TeachplanController {

    @Resource
    private TeachplanService teachplanService;

    @ApiOperation("查询课程计划树形结构")
    @GetMapping("/teachplan/{courseId}/tree-nodes")
    public List<TeachplanDto> getTreeNodes(@PathVariable("courseId") Long courseId){
        return teachplanService.findTeachplanTree(courseId);
    }

    @PostMapping("/teachplan")
    public void saveTeachplan(@RequestBody SaveTeachplanDto saveTeachplanDto){
        teachplanService.saveTeachplan(saveTeachplanDto);
    }

    @ApiOperation(value = "课程计划和媒资信息绑定")
    @PostMapping("/teachplan/association/media")
    public void associationMedia(@RequestBody BindTeachplanMediaDto bindTeachplanMediaDto){
        TeachplanMedia teachplanMedia = teachplanService.associationMedia(bindTeachplanMediaDto);
    }
}
